package com.zimin.cloud.system.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zimin.cloud.mine.pojo.system.view.AccountVO;
import com.zimin.cloud.system.pojo.entity.Account;
import com.zimin.mapper.injector.InjectBaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 用户信息 Mapper 接口
 * </p>
 *
 * @author zimin
 * @since 2022-01-24 17:29
 */
public interface AccountMapper extends InjectBaseMapper<Account> {


    @Select("select  account.*,dept.dept_name as deptName,accountPost.post_id as postId,accountRole.role_id as roleId" +
            " from  sys_account account " +
            " left join sys_dept dept on account.dept_id = dept.id " +
            " left join sys_account_post accountPost on accountPost.account_id = account.id " +
            " left join sys_account_role accountRole on accountRole.account_id = account.id " +
            "${ew.customSqlSegment} ")
    Page<AccountVO> page(Page<Account> accountPage, @Param(Constants.WRAPPER) QueryWrapper queryWrappers);
}
